<?php

namespace App\Http\Controllers\Agency;

use App\Services\InteractService;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use hg\apidoc\annotation as Apidoc;
/**
 * 互动消息
 * @Apidoc\Group("market")
 */

class InteractController extends Controller
{
    /**
     * @Apidoc\Title ("互动消息-浏览记录")
     * @Apidoc\Url("/agency/getVisitList")
     * @Apidoc\Method("POST")
     * @Apidoc\Header("Authorization", type="string",require=true, desc="Bearer + accessToken")
     * @Apidoc\Param("mid",type="string",desc="浏览者id")
     * @Apidoc\Param("otherid",type="string",desc="被浏览者id")
     * @Apidoc\Param("minNums",type="string",desc="最小浏览次数")
     * @Apidoc\Param("maxNums",type="string",desc="最大浏览次数")
     * @Apidoc\Param("startTime",type="string",desc="开始时间")
     * @Apidoc\Param("endTime",type="string",desc="结束时间")
     * @Apidoc\Returned("viewnums",type="string",desc="浏览次数")
     * @Apidoc\Returned("updated_at",type="string",desc="最近浏览时间")
     * @Apidoc\Returned("base",type="object",desc="浏览者基本信息")
     * @Apidoc\Returned("obase",type="object",desc="被浏览者基本信息")
     *
     */
    public function getVisitList(Request $request ,InteractService $interactService)
    {
        $params = $request->input();
        $params['aid'] = $this->getAid();
        $result = $interactService->getVisitList($params);
        return $this->responseSuccess($result);
    }

    /**
     * @Apidoc\Title ("互动消息-删除浏览记录")
     * @Apidoc\Url("/agency/visitDel")
     * @Apidoc\Method("POST")
     * @Apidoc\Header("Authorization", type="string",require=true, desc="Bearer + accessToken")
     * @Apidoc\Param("id",type="int",require=true,desc="列表id")
     * @Apidoc\Returned("true",type="bool",desc="保存状态")
     *
     */

    public function visitDel(Request $request , InteractService $interactService)
    {
        $params = $request->input();
        $result = $interactService->visitDel($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError(400);
    }

    /**
     * @Apidoc\Title ("互动消息-关注记录")
     * @Apidoc\Url("/agency/getCareList")
     * @Apidoc\Method("POST")
     * @Apidoc\Header("Authorization", type="string",require=true, desc="Bearer + accessToken")
     * @Apidoc\Param("mid",type="string",desc="关注者id")
     * @Apidoc\Param("otherid",type="string",desc="被关注者id")
     * @Apidoc\Param("startTime",type="string",desc="开始关注时间")
     * @Apidoc\Param("endTime",type="string",desc="结束关注时间")
     * @Apidoc\Returned("created_at",type="string",desc="关注时间")
     * @Apidoc\Returned("base",type="object",desc="关注者基本信息")
     * @Apidoc\Returned("obase",type="object",desc="被关注者基本信息")
     *
     */
    public function getCareList(Request $request ,InteractService $interactService)
    {
        $params = $request->input();
        $params['aid'] = $this->getAid();
        $result = $interactService->getCareList($params);
        return $this->responseSuccess($result);
    }

    /**
     * @Apidoc\Title ("互动消息-删除关注记录")
     * @Apidoc\Url("/agency/careDel")
     * @Apidoc\Method("POST")
     * @Apidoc\Header("Authorization", type="string",require=true, desc="Bearer + accessToken")
     * @Apidoc\Param("id",type="int",require=true,desc="列表id")
     * @Apidoc\Returned("true",type="bool",desc="保存状态")
     *
     */

    public function careDel(Request $request , InteractService $interactService)
    {
        $params = $request->input();
        $result = $interactService->careDel($params);
        if($result)
            return $this->responseSuccess($result);
        else
            return $this->responseError(400);
    }
}
